package com.ibm.cps.sql;

import java.util.List;
import java.util.Map;

import net.sf.jsqlparser.expression.Expression;

import com.ibm.cps.sql.expression.ExpressionNode;

public class DecomposedSQL {
	private final Map<String, ExpressionNode> targetFields;
	private final List<Expression> filterConditions;
	private final List<Expression> aggregation;
	private final List<String> fromItems;
	private final List<String> outputItems;

	public DecomposedSQL(Map<String, ExpressionNode> targetFields,
			List<Expression> filterConditions, List<Expression> aggregation,
			List<String> fromItems, List<String> outputItems) {
		this.targetFields = targetFields;
		this.filterConditions = filterConditions;
		this.aggregation = aggregation;
		this.fromItems = fromItems;
		this.outputItems = outputItems;
	}

	public Map<String, ExpressionNode> getTargetFields() {
		return targetFields;
	}

	public List<Expression> getFilterConditions() {
		return filterConditions;
	}

	public List<Expression> getAggregation() {
		return aggregation;
	}

	public List<String> getFromItems() {
		return fromItems;
	}

	public List<String> getOutputItems() {
		return outputItems;
	}

	@Override
	public String toString() {
		return "{\"DecoupledSQL\":{\"targetFields\":\"" + targetFields
				+ "\", \"filterConditions\":\"" + filterConditions
				+ "\", \"aggregation\":\"" + aggregation
				+ "\", \"fromItems\":\"" + fromItems + "\", \"outputItems\":\""
				+ outputItems + "\"}}";
	}

}
